//
//  Ground.cpp
//  EidoTron
//
//  Created by Luca Di Franco on 12/05/11.
//  Copyright 2011 Luca Di Franco. All rights reserved.
//

#include "Battleground.h"

Battleground::Battleground() : BOEntity("groundtile.obj")
{ 
	size_x = 20;
	size_z = 20;
	
	
	for (vector< Material* >::iterator iter = materials.begin(); iter != materials.end(); iter++)
	{
		Material* currMaterial = *iter;
		map< Material*, vector< Vertex >* >::iterator verticesIter = verticesMap.find(currMaterial);
		if (verticesIter != verticesMap.end())
		{
			float* verticesArray = (float*) &(*verticesIter->second)[0];
			for (int i = 0; i < 3 * verticesIter->second->size(); i+=3)
			{
				verticesArray[i] *= size_x;
				verticesArray[i+2] *= size_z;
			}
		}
		map< Material*, vector< TextCoord >* >::iterator textCoordsIter = textCoordsMap.find(currMaterial);
		if (textCoordsIter != textCoordsMap.end())
		{
			float* textCoordsArray = (float*) &(*textCoordsIter->second)[0];
			for (int i = 0; i < 3 * textCoordsIter->second->size(); i+=3)
			{
				textCoordsArray[i] *= size_x;
				textCoordsArray[i+2] *= size_z;
			}
		}
	}
}

Battleground::~Battleground()
{ }